//
//  LHBaseModel.m
//  EPA
//
//  Created by 卢浩 on 16/4/18.
//  Copyright © 2016年 卢浩. All rights reserved.
//

#import "LHBaseModel.h"
#import "LHRadioModel.h"
#import "LHReadingModel.h"
#import "LHTopicsModel.h"
#import "LHProductsModel.h"

@implementation LHBaseModel

+ (instancetype)modelWithDict:(NSDictionary *)dict{
    //电台
    if ([dict.allKeys containsObject:@"radioid"]) {
        LHRadioModel *radioModel = [[LHRadioModel alloc]init];
        [radioModel setValuesForKeysWithDictionary:dict];
        return radioModel;
    //阅读
    }else if ([dict.allKeys containsObject:@"name"]){
        LHReadingModel *readingModel = [[LHReadingModel alloc]init];
        [readingModel setValuesForKeysWithDictionary:dict];
        return readingModel;
    //话题
    }else if ([dict.allKeys containsObject:@"userinfo"]){
        LHTopicsModel *topicsModel = [[LHTopicsModel alloc]init];
        [topicsModel setValuesForKeysWithDictionary:dict];
        return topicsModel;
    //良品
    }else if ([dict.allKeys containsObject:@"buyurl"]){
        LHProductsModel *productsModel = [[LHProductsModel alloc]init];
        [productsModel setValuesForKeysWithDictionary:dict];
        return productsModel;
    }
    return nil;
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key{
    
}

@end
